home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
CSCROLLL
/
ABOUT_TH.E_F
next >
Wrap
Text File
|
1992-02-19
|
3KB
|
88 lines
Some notes on CScrollList and CCheckList
========================================
WARNING!! - I was tinkering when I put these two classes together.
Because I still intend to rewrite my own CTable and CArrayPane
classes that are based on a single column implementation, I
didn't design these to stand the test of time. So, if you feel
there isn't enough error checking or that they are not robust
enough for you, hack the code apart and rewrite it how _you_
think it should be written.
( IF, on the other hand, you find yourself staring at my code in awe and
thinking aloud, "My God, this guy's a genius!" call your shrink 'cause
you need help, but call me first because I could _really_ use a job! )
In any event, there are a few things you should know about the classes:
Ñ They expect two cursor handles to be loaded and locked (HNoPurge'd).
Ñ They require CTextEnvirons, CArrayPane, CTable, and CTableDragger.
These are non-core TCL classes, so don't forget them!
Ñ You must override a few methods to make them do anything useful.
CURSOR RESOURCES
================
To load and lock the resources (for better or for worse), I just put the
following code in my IMyApp method:
gCheckCursor = GetCursor( kCheckCursorID); // Get both cursors
HNoPurge( (Handle) gCheckCursor);
gHandCursor = GetCursor( kHandCursorID);
HNoPurge( (Handle) gHandCursor);
For your convenience, the two 'curs' resources have been included.
NON-CORE CLASSES
================
What can I say? Simply make sure they are in your project. Take a look at
the NewClassDemo project that came with THINK C as an example.
OVERRIDING FUNCTIONS
====================
To use CScrollList, you must override GetCellText which is originally
from the CTable class.
void CYourSList::GetCellText( Cell theCell,
short availableWidth, StringPtr itsText)
CCheckList requires you to override two more methods: CheckCell and
IsChecked. The prototypes for these methods are
Boolean CYourCList::IsChecked( Cell theCell )
void CYourCList::CheckCell( Cell theCell )
One might also argue that there should be a SetCheck method, just as there
should be a SetItemEnable for menu items. But that's a different story...
FURTHER NOTES
=============
To create your own cool lists, just rewrite (I mean override :)
the DrawCell method so it doesn't rely on text, or so you can include
other graphics and text, etc.
void CYourCList::DrawCell( Cell theCell, Rect *cellRect )
If you do anything with these classes, I'd really like to see it (if that
is possible). I'm curious as to what others are doing with the TCL, and
I can always use more sample code. At least write me a note acknowledging
my existance.
PLEASE send questions and comments (job offers ;) to
AOL: Dave J H
internet: a540dav@pic.ucla.edu
Good luck, and enjoy!